Package eu.europa.ec.taxud.cesop.utils
Class ValidationErrorUtils
java.lang.Object
eu.europa.ec.taxud.cesop.utils.ValidationErrorUtils
Util class handling error records.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcheckCmBr0010(List<ValidationError> validationErrors, String messageRefId, Set<String> docRefIds, String docRefId) Checks if the DocRefId is not unique in the message (20010).static voidcheckCmBr0050(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docTypeEnum, String corrDocRefId, String docRefId) Checks if the CorrDocRefId is not specified for new data (20050).static voidcheckCmBr0060(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docTypeEnum, String corrDocRefId, String docRefId) Checks if the corrDocRefId is provided in case of correction (20060).static voidcheckCmBr0100(List<ValidationError> validationErrors, String messageRefId, XmlTypeAndValue pspId) Checks Psp BIC conforms ISO-9362.static voidcheckCmBr0110(List<ValidationError> validationErrors, String messageRefId, MessageTypeIndicEnum messageTypeIndic) Given there's no payees in the message, check if it is allowed for the specified type of message.static voidcheckCmBr0120(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docTypeEnum, String corrDocRefId, Set<String> corrDocRefIds, String xsdVersion, String docRefId) Checks if the corrDocRefId references to single message in case of correction (20120).static voidcheckCmBr0130(List<ValidationError> validationErrors, String messageRefId, String type, String other, String xsdVersion) Checks discrepancy in the provision of an ‘other’ type and its specification, leading to a full rejectionstatic voidcheckCmBr0140(List<ValidationError> validationErrors, String messageRefId, String type, String other, String xsdVersion) Checks discrepancy in the provision of an ‘other’ type and its specification, leading to a partial rejectionstatic voidcheckCmBr0140ForDates(List<ValidationError> validationErrors, String messageRefId, Map<TransactionDateEnum, XmlTransactionDate> dates, String xsdVersion) For transaction dates.static voidcheckCmBr0150(List<ValidationError> validationErrors, String messageRefId, HashMap<Set<XmlTypeAndValue>, String> reportedPayees, List<XmlTypeAndValue> names, List<XmlCountryTypeAndValue> accounts, String docRefId) Checks if the current reported payee is not a duplicate of a previously reported payee.static voidcheckCmTr0020(List<ValidationError> validationErrors, String messageRefId) Failed Decryption (50020).static voidcheckCmTr0030(List<ValidationError> validationErrors, String messageRefId) Failed Decompression (50030).static voidcheckCmTr0040(List<ValidationError> validationErrors, String messageRefId) Failed Signature Check (50040).static voidcheckCmTr0050(List<ValidationError> validationErrors, String messageRefId) Failed Threat Scan (50050).static voidcheckCmTr0060(List<ValidationError> validationErrors, String messageRefId) Failed Virus Scan (50060).static voidcheckCmTr0070(List<ValidationError> validationErrors, String messageRefId, long size, long maxSize) Message size exceeded (50070).static voidcheckMhBr0030(List<ValidationError> validationErrors, String messageRefId, Integer period, Integer minPeriod) Checks if the period is not before 01/01/2024 (10030).static voidcheckMhBr0070AndMhBr0080(List<ValidationError> validationErrors, String messageRefId, MessageTypeIndicEnum messageTypeIndic, DocTypeEnum docType, String docRefId) Checks if an initial Payment data message only contains new data and if a correction message only contains corrections/deletions (10070 and 10080).static voidcheckMhBr0090(List<ValidationError> validationErrors, String messageRefId, MessageTypeEnum messageType, boolean hasPaymentDataBody) A payment data message (MessageType = 'PMT') must contain the 'PaymentDataBody' element.static voidcheckMhBr0100(List<ValidationError> validationErrors, String messageRefId, MessageTypeIndicEnum messageTypeIndic, Integer period, Integer correlatedPeriod) In a correction message, the reporting period must be identical to the reporting period of the correlated message.static voidcheckMhBr0110(List<ValidationError> validationErrors, String messageRefId, String corrMessageRefId, MessageTypeIndicEnum messageTypeIndic) CorrMessageRefId in the 'MessageSpec' element must only be provided in correction messages (when 'MessageTypeIndic' = CESOP101).static voidcheckMhBr0120(List<ValidationError> validationErrors, String messageRefId, String transmittingCountry, String requiredCountry) TransmittingCountry in the 'MessageSpec' element must be the same as required country if that is passed.static voidcheckRpBr0010(List<ValidationError> validationErrors, String messageRefId, String payeeCountry, String payerMsCountry, String transactionIdentifier) Checks if the country code of the 'Country' element within the 'ReportedPayee' element is not the same as the country code of the 'PayerMS' element (40010).static voidcheckRpBr0020(List<ValidationError> validationErrors, String messageRefId, String accountIdentifierType, String iban, String docRefId) Checks the IBAN format (40020).static voidcheckRpBr0030(List<ValidationError> validationErrors, String messageRefId, String accountIdentifierType, String countryCode, String iban, String docRefId) Validates the IBAN (40030) based on the countryCode IBAN length and the MOD97 algorithm.static voidcheckRpBr0040(List<ValidationError> validationErrors, String messageRefId, boolean hasPaymentData, MessageTypeIndicEnum messageTypeIndic) Checks if no Reported payee is listed in no payment data for the requested period handler (40040).static voidcheckRpBr0050(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docType, boolean emptyTransactions) Checks if the 'ReportedTransaction' element is present, except in case of deletion of the related Reported Payee.static voidcheckRpBr0060(List<ValidationError> validationErrors, XmlCountryTypeAndValue account, String messageRefId) Checks if there is no discrepancy in the 'AccountIdentifier' attributes.static voidcheckRpBr0070(List<ValidationError> validationErrors, String messageRefId, XmlTypeAndValue representativeId, String docRefId) Checks if the representative's BIC conforms ISO-9362.static voidcheckRpBr0080(List<ValidationError> validationErrors, String messageRefId, XmlCountryTypeAndValue accountIdentifier, XmlPsp representative, String docRefId) static voidcheckRpBr0090(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docType, boolean emptyTransactions, String docRefId, String xsdVersion) static voidcheckRtBr0010(List<ValidationError> validationErrors, String messageRefId, boolean isRefund, XmlTypeAndValue amount, String transactionIdentifier) Checks the amount value.static voidcheckRtBr0030(List<ValidationError> validationErrors, String messageRefId, Integer period, EnumMap<TransactionDateEnum, XmlTransactionDate> dates, String transactionIdentifier) Checks if at least one 'DateTime' element in the 'ReportedTransaction' element refers to a date within the period and year declared in the 'ReportingPeriod' element (45030).static voidcheckRtBr0040(List<ValidationError> validationErrors, String messageRefId, Set<String> transactionIdentifiers, String transactionIdentifier) Checks if the transaction identifier is unique in message handler (45040).static voidcheckRtBr0060(List<ValidationError> validationErrors, String messageRefId, String amount, String transactionIdentifier) Checks if the value of the 'Amount' element is not equal to zero (45060).static voidcheckRtBr0080(List<ValidationError> validationErrors, String messageRefId, boolean isInErrorRtBr0080, String transactionIdentifier) Checks if the same type of transaction date has not been provided more than once (45080).static StringconvertGreece(String code) static ValidationErrorcreateCustomError(String messageRefId, String description) Custom error (99999).static ValidationErrorcreateValidationError(ValidationErrorTypeEnum errorType, String messageRefId) Create aValidationErrorfrom anValidationErrorTypeEnum.static ValidationErrorcreateValidationError(ValidationErrorTypeEnum errorType, String messageRefId, String docRefId, String transactionIdentifier) Create aValidationErrorfrom anValidationErrorTypeEnum.
-
Field Details
-
XML_DATE_TIME_FORMATTER_READER
-
XML_DATE_TIME_FORMATTER_WRITER
-
-
Method Details
-
checkMhBr0070AndMhBr0080
public static void checkMhBr0070AndMhBr0080(List<ValidationError> validationErrors, String messageRefId, MessageTypeIndicEnum messageTypeIndic, DocTypeEnum docType, String docRefId) Checks if an initial Payment data message only contains new data and if a correction message only contains corrections/deletions (10070 and 10080).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagemessageTypeIndic- the message type indicdocType- the doc typedocRefId- the doc ref id
-
checkCmBr0010
public static void checkCmBr0010(List<ValidationError> validationErrors, String messageRefId, Set<String> docRefIds, String docRefId) Checks if the DocRefId is not unique in the message (20010).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagedocRefIds- the docref ids already checkeddocRefId- the docref id
-
checkCmBr0050
public static void checkCmBr0050(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docTypeEnum, String corrDocRefId, String docRefId) Checks if the CorrDocRefId is not specified for new data (20050).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagedocTypeEnum- the doc type enumcorrDocRefId- the corr doc ref iddocRefId- the doc ref id
-
checkCmBr0060
public static void checkCmBr0060(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docTypeEnum, String corrDocRefId, String docRefId) Checks if the corrDocRefId is provided in case of correction (20060).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagedocTypeEnum- the doc type enumcorrDocRefId- the corrDocRefIddocRefId- the doc ref id
-
checkCmBr0120
public static void checkCmBr0120(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docTypeEnum, String corrDocRefId, Set<String> corrDocRefIds, String xsdVersion, String docRefId) Checks if the corrDocRefId references to single message in case of correction (20120).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagedocTypeEnum- the doc type enumcorrDocRefId- the corrDocRefIdcorrDocRefIds- list of corrDocRefIds fetched from related message by CorrMessageRefIddocRefId- the doc ref id
-
checkRpBr0010
public static void checkRpBr0010(List<ValidationError> validationErrors, String messageRefId, String payeeCountry, String payerMsCountry, String transactionIdentifier) Checks if the country code of the 'Country' element within the 'ReportedPayee' element is not the same as the country code of the 'PayerMS' element (40010).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagepayeeCountry- the payee countrypayerMsCountry- the payer MS countrytransactionIdentifier- the transaction identifier id
-
checkRpBr0020
public static void checkRpBr0020(List<ValidationError> validationErrors, String messageRefId, String accountIdentifierType, String iban, String docRefId) Checks the IBAN format (40020).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messageaccountIdentifierType- the account identifier type enumiban- the ibandocRefId- the doc ref id
-
checkRpBr0030
public static void checkRpBr0030(List<ValidationError> validationErrors, String messageRefId, String accountIdentifierType, String countryCode, String iban, String docRefId) Validates the IBAN (40030) based on the countryCode IBAN length and the MOD97 algorithm.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messageaccountIdentifierType- the account identifier type enumcountryCode- the country codeiban- the ibandocRefId- the doc ref id
-
checkRpBr0040
public static void checkRpBr0040(List<ValidationError> validationErrors, String messageRefId, boolean hasPaymentData, MessageTypeIndicEnum messageTypeIndic) Checks if no Reported payee is listed in no payment data for the requested period handler (40040).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagehasPaymentData- if the transaction has payment datamessageTypeIndic- the message type indic
-
checkRpBr0050
public static void checkRpBr0050(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docType, boolean emptyTransactions) Checks if the 'ReportedTransaction' element is present, except in case of deletion of the related Reported Payee. (40050).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagedocType- the doc type of the reported payeeemptyTransactions- true if no reported transactions for this reported payee
-
checkRpBr0060
public static void checkRpBr0060(List<ValidationError> validationErrors, XmlCountryTypeAndValue account, String messageRefId) Checks if there is no discrepancy in the 'AccountIdentifier' attributes. (40060)- Parameters:
validationErrors- the validation errorsaccount- the accountmessageRefId- the message ref id
-
checkMhBr0030
public static void checkMhBr0030(List<ValidationError> validationErrors, String messageRefId, Integer period, Integer minPeriod) Checks if the period is not before 01/01/2024 (10030).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messageperiod- the periodminPeriod- the minimum period allowed
-
checkMhBr0090
public static void checkMhBr0090(List<ValidationError> validationErrors, String messageRefId, MessageTypeEnum messageType, boolean hasPaymentDataBody) A payment data message (MessageType = 'PMT') must contain the 'PaymentDataBody' element.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagemessageType- the message typehasPaymentDataBody- true if the message contains a 'PaymentDataBody' element, false otherwise
-
checkMhBr0100
public static void checkMhBr0100(List<ValidationError> validationErrors, String messageRefId, MessageTypeIndicEnum messageTypeIndic, Integer period, Integer correlatedPeriod) In a correction message, the reporting period must be identical to the reporting period of the correlated message.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the message ref idmessageTypeIndic- the message type indicperiod- the message periodcorrelatedPeriod- the period of the correlated message
-
checkMhBr0110
public static void checkMhBr0110(List<ValidationError> validationErrors, String messageRefId, String corrMessageRefId, MessageTypeIndicEnum messageTypeIndic) CorrMessageRefId in the 'MessageSpec' element must only be provided in correction messages (when 'MessageTypeIndic' = CESOP101). Otherwise, the element must not be provided.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the message ref idcorrMessageRefId- the CorrMessageRefId valuemessageTypeIndic- the message type indic
-
checkMhBr0120
public static void checkMhBr0120(List<ValidationError> validationErrors, String messageRefId, String transmittingCountry, String requiredCountry) TransmittingCountry in the 'MessageSpec' element must be the same as required country if that is passed. EU is a wildcard and should allow the upload for any MS.- Parameters:
validationErrors- the validation errorsmessageRefId- the message ref idtransmittingCountry- the transmitting countryrequiredCountry- the required country
-
checkRtBr0010
public static void checkRtBr0010(List<ValidationError> validationErrors, String messageRefId, boolean isRefund, XmlTypeAndValue amount, String transactionIdentifier) Checks the amount value. The refund attribute refers to a wrong value declared in the AmountCurrency element. When the refund attribute is set to 'false', the value of the amount in AmountCurrency element must be positive. When the refund attribute is set to 'true', the value of the amount in the AmountCurrency element must be negative.- Parameters:
validationErrors- the validation errorsmessageRefId- the message ref idisRefund- the is refundamount- the amounttransactionIdentifier- the transaction identifier
-
checkRtBr0030
public static void checkRtBr0030(List<ValidationError> validationErrors, String messageRefId, Integer period, EnumMap<TransactionDateEnum, XmlTransactionDate> dates, String transactionIdentifier) Checks if at least one 'DateTime' element in the 'ReportedTransaction' element refers to a date within the period and year declared in the 'ReportingPeriod' element (45030).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messageperiod- the perioddates- the transaction datestransactionIdentifier- the transaction identifier id
-
checkRtBr0040
public static void checkRtBr0040(List<ValidationError> validationErrors, String messageRefId, Set<String> transactionIdentifiers, String transactionIdentifier) Checks if the transaction identifier is unique in message handler (45040).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagetransactionIdentifiers- the transaction identifiers ids already checkedtransactionIdentifier- the transaction identifier id
-
checkRtBr0060
public static void checkRtBr0060(List<ValidationError> validationErrors, String messageRefId, String amount, String transactionIdentifier) Checks if the value of the 'Amount' element is not equal to zero (45060).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messageamount- the amounttransactionIdentifier- the transaction identifier id
-
checkRtBr0080
public static void checkRtBr0080(List<ValidationError> validationErrors, String messageRefId, boolean isInErrorRtBr0080, String transactionIdentifier) Checks if the same type of transaction date has not been provided more than once (45080). This rule is checked during the reported transactions parsing.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messageisInErrorRtBr0080- true if the rule is not respectedtransactionIdentifier- the transaction identifier id
-
checkCmTr0020
Failed Decryption (50020).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the message
-
checkCmTr0030
Failed Decompression (50030).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the message
-
checkCmTr0040
Failed Signature Check (50040).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the message
-
checkCmTr0050
Failed Threat Scan (50050).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the message
-
checkCmTr0060
Failed Virus Scan (50060).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the message
-
checkCmTr0070
public static void checkCmTr0070(List<ValidationError> validationErrors, String messageRefId, long size, long maxSize) Message size exceeded (50070).- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagesize- the size of messagemaxSize- the max size authorized
-
checkCmBr0110
public static void checkCmBr0110(List<ValidationError> validationErrors, String messageRefId, MessageTypeIndicEnum messageTypeIndic) Given there's no payees in the message, check if it is allowed for the specified type of message.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagemessageTypeIndic- the type of message indic being validated
-
checkRpBr0070
public static void checkRpBr0070(List<ValidationError> validationErrors, String messageRefId, XmlTypeAndValue representativeId, String docRefId) Checks if the representative's BIC conforms ISO-9362.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagerepresentativeId- the representative iddocRefId- the doc ref id
-
checkCmBr0100
public static void checkCmBr0100(List<ValidationError> validationErrors, String messageRefId, XmlTypeAndValue pspId) Checks Psp BIC conforms ISO-9362.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagepspId- the psp id
-
checkCmBr0130
public static void checkCmBr0130(List<ValidationError> validationErrors, String messageRefId, String type, String other, String xsdVersion) Checks discrepancy in the provision of an ‘other’ type and its specification, leading to a full rejection- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagetype- the type attribute valueother- the other attribute value
-
checkCmBr0140
public static void checkCmBr0140(List<ValidationError> validationErrors, String messageRefId, String type, String other, String xsdVersion) Checks discrepancy in the provision of an ‘other’ type and its specification, leading to a partial rejection- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagetype- the type attribute valueother- the other attribute value
-
checkCmBr0140ForDates
public static void checkCmBr0140ForDates(List<ValidationError> validationErrors, String messageRefId, Map<TransactionDateEnum, XmlTransactionDate> dates, String xsdVersion) For transaction dates. Checks discrepancy in the provision of an ‘other’ type and its specification, leading to a partial rejection.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the reference of the messagedates- map of transaction dates
-
checkRpBr0080
public static void checkRpBr0080(List<ValidationError> validationErrors, String messageRefId, XmlCountryTypeAndValue accountIdentifier, XmlPsp representative, String docRefId) -
checkRpBr0090
public static void checkRpBr0090(List<ValidationError> validationErrors, String messageRefId, DocTypeEnum docType, boolean emptyTransactions, String docRefId, String xsdVersion) -
checkCmBr0150
public static void checkCmBr0150(List<ValidationError> validationErrors, String messageRefId, HashMap<Set<XmlTypeAndValue>, String> reportedPayees, List<XmlTypeAndValue> names, List<XmlCountryTypeAndValue> accounts, String docRefId) Checks if the current reported payee is not a duplicate of a previously reported payee. The check is done by comparing the set of non-empty names and account identifiers of the current reported payee with the previously seen reported payees.- Parameters:
validationErrors- the list of validation errorsmessageRefId- the message ref idreportedPayees- the map of seen reported payees, maps the set of names and account identifiers to the doc ref idnames- the names of the payeeaccounts- the account identifiers of the payeedocRefId- the doc ref id
-
createCustomError
Custom error (99999).- Parameters:
messageRefId- the reference of the messagedescription- the description of the error- Returns:
- the validation error
-
createValidationError
public static ValidationError createValidationError(ValidationErrorTypeEnum errorType, String messageRefId) Create aValidationErrorfrom anValidationErrorTypeEnum.- Parameters:
errorType- the validation error typemessageRefId- the reference of the message- Returns:
- the validation error
-
createValidationError
public static ValidationError createValidationError(ValidationErrorTypeEnum errorType, String messageRefId, String docRefId, String transactionIdentifier) Create aValidationErrorfrom anValidationErrorTypeEnum.- Parameters:
errorType- the validation error typemessageRefId- the reference of the messagedocRefId- the doc ref idtransactionIdentifier- the transaction identifier- Returns:
- the validation error
-
convertGreece
-